/*!
    \copyright  Copyright (c) 2023 Qualcomm Technologies International, Ltd.\n
                All Rights Reserved.\n
                Qualcomm Technologies International, Ltd. Confidential and Proprietary.
    \file
    \addtogroup connection_manager
    @{
    \brief      The sending of events from the connection_manager using the Event Bus
*/

#ifndef CON_MANAGER_EVENT_SEND_H_
#define CON_MANAGER_EVENT_SEND_H_

#ifdef USE_SYNERGY
#include "le_audio_core_channel_event_spec.h"
#include "connection_manager_protected.h"
#include <csr_bt_cm_prim.h>

/*! \brief Send Disconnection Complete Event.

    \param connection_handle  Conn handle of disconnected LE link
	\param reason  Reason of disconnection
	\param link_type  type of disconnected link
	
    \return Mapped bluetooth address corrosponding to handle passed as param.
 */
void conManager_SendDisconnectionCompleteEvent(uint16_t connection_handle, hci_status reason, acl_link_type_t link_type);


/*! \brief Send Enhanced Connection Complete Event.

    \param ind Pointer to parameters
    \param conn_handle Connection handle of connected LE link

    \return Mapped bluetooth address corrosponding to handle passed as param.
 */
void conManager_SendEnhancedConnectionCompleteEvent(const CsrBtCmLeEventConnectionInd *ind, uint16_t conn_handle);

/*! \brief Send Connection Update Complete Event.

    \param status Hci success or failure status
	\param connection_handle Conn handle of connected LE link
	\param conn_interval Interval of LE ACL link
	\param conn_latency Latency of LE ACL link
	\param supervision_Timeout Supervision TO of LE ACL link

 */
/*! \brief Send Connection Update Complete Event.
 */
void conManager_SendConnectionUpdateCompleteEvent(hci_status status, uint16_t connection_handle, uint16_t  conn_interval,
                                                  uint16_t conn_latency, uint16_t supervision_Timeout );


/*! \brief Send Enhanced Connection Complete Event.

    \param conn_handle Connection handle of LE link
    \param current_path_loss current path loss in dB
    \param zone_entered 0,1,2 == low/middle/high
*/
void conManager_SendPathLossThresholdReportEvent(uint16_t conn_handle, uint8_t current_path_loss, uint8_t zone_entered);

/*! \brief Send LE Subrate change event

    \param conn_handle Conn handle of connected LE link
    \param status Hci success or failure status
    \param subrate_factor New subrate factor for underlying connection interval
    \param peripheral_latency Peripheral latency for the connection (multiple of connection events)
    \param continuation_number Number of underlying connection events to remain active after a
           packet containing a Link Layer PDU with a non-zero Length field is sent or received
    \param supervision_timeout New supervision timeout for this LE connection.
*/
void conManager_SendSubrateChangeEvent(uint16_t conn_handle, 
                                       hci_status status,
                                       uint16 subrate_factor,
                                       uint16 peripheral_latency,
                                       uint16 continuation_number,
                                       uint16 supervision_timeout);
#else

#define conManager_SendDisconnectionCompleteEvent(x, y, z)
#define conManager_SendEnhancedConnectionCompleteEvent(x, y)
#define conManager_SendConnectionUpdateCompleteEvent(a, b, c, d, e)
#define conManager_SendSubrateChangeEvent(a, b, c, d, e, f)

#endif /* USE_SYNERGY */

#endif /* CON_MANAGER_EVENT_SEND_H_ */
/*! @} */